<?php
use yii\helpers\Url;

$web = Url::base();
$integral_unit = \app\models\Mall::getCurrentInstitutionIntegralUnit();
$integral_rate = \app\models\Mall::getCurrentInstitutionIntegralRate();
$institution_code = \app\models\Mall::getCurrentInstitutionCode();
?>
<div class="order-list">
    <?php
    if ($items != null) {
        for ($i = 0; $i < count($items); $i++) {
            $goodsitems = $items[$i]['goods_list'];
            ?>
            <div class="list-details">
                <div class="order-massage">
                    <span class="order-time"><?= $items[$i]['create_datetime'] ?></span>
                    <psn class="order-state" ><?= $items[$i]['status_name'] ?></psn>
                </div>
                <?php
                if ($goodsitems != null) {
                    for ($j = 0; $j < count($goodsitems); $j++) {
                        ?>
                        <div class="goods-list">
                            <img src="<?= $goodsitems[$j]['image_url'] ?>@60w"/>
                            <div class="goods-massage">
                                <p class="goods-massage-title">
                                    <?php
                                    if($goodsitems[$j]['is_crossborder']=='1'){
                                        ?>
                                        <span class="cross-title-icon">跨境</span>
                                        <?php
                                    }
                                    ?>
                                    <?= $goodsitems[$j]['goods_name'] ?></p>
                                <p class="goods-massage-integral"><?= $integral_unit ?>：<?= number_format($goodsitems[$j]['selling_integral']) ?></p>
                                <p class="goods-massage-num">数量：<?= $goodsitems[$j]['quantity'] ?></p>
                            </div>
                        </div>
                        <?php
                    }
                }
                ?>
                <a href="order-detail?orderId=<?= $items[$i]['id'] ?>&institution_code=<?= $institution_code ?>" class="order-btn">订单详情</a>
                <div class="clearing">
                    <span class="clearing-num">共<?= $items[$i]['total_quantity'] ?>件商品</span>
                    <span class="clearing-integral"><?= $integral_unit ?>：<?= number_format($items[$i]['total_selling_price'] * $integral_rate) ?></span>
                </div>
            </div>
            <?php
        }
    }
    ?>
</div>
